package blackitheima1.MathTest;

public class Mathtesr {
    public static void main(String[] args) {
        //绝对值
        int abs = Math.abs(-10);
        System.out.println("绝对值:"+abs);
        //向上取整 ceil
        double ceil = Math.ceil(1.8);
        System.out.println("向上取整:"+ceil);
        //向下取整 floor
        double floor = Math.floor(1.8);
        System.out.println("向下取整:"+floor);
        //四舍五入 round
        long round = Math.round(3.5);
        System.out.println("四舍五入:"+round);
        //int 类型的最大值 max
        int max1 = Math.max(1, 3);
        double max = Math.max(4.5, 5.6);
        System.out.println("int最大值"+max1);
        System.out.println("double最大值:"+max);
        //最小值 min
        int min = Math.min(1, 3);
        double min1 = Math.min(1.5, 5.6);
        System.out.println("int最小值:"+min);
        System.out.println("double最小值:"+min);
        //a的b次幂  Math.pow(a,b)
        double pow = Math.pow(2, 8);
        System.out.println("2的8次幂:"+pow);
        //[0.0,1.0)之间的随机数  random
        System.out.println("[0.0,1.0)之间的随机数:");
        for (int i = 0; i < 10; i++) {
            double random = Math.random();
            System.out.println(random);
        }

    }
}
